/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nl.hva.web.mvcwebapp.models;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

@Embeddable
public class PageWidgetId implements java.io.Serializable {

    private Page page;
    private Widget widget;

    @ManyToOne
    public Page getPage() {
        return page;
    }

    public void setPage(Page page) {
        this.page = page;
    }

    @ManyToOne
    public Widget getWidget() {
        return widget;
    }

    public void setWidget(Widget widget) {
        this.widget = widget;
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        PageWidgetId that = (PageWidgetId) o;

        if (page != null ? !page.equals(that.page) : that.page != null) {
            return false;
        }
        if (widget != null ? !widget.equals(that.widget) : that.widget != null) {
            return false;
        }
        return true;
    }

    public int hashCode() {
        int result;
        result = (page != null ? page.hashCode() : 0);
        result = 31 * result + (widget != null ? widget.hashCode() : 0);
        return result;
    }
}